

FinderFactory = {

    attribute: function (name, value) {
        var str = "<tf:attribute ";
        str = addAttrs(str, {name:name, value:value});
        str += "/>";
        return wrap(str);
    },

    index: function (index) {
        var str = "<tf:index ";
        str = addAttrs(str, {index:index});
        str += "/>";
        return wrap(str);
    },

    tag: function (value) {
        var str = "<tf:tag ";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    text: function (value) {
        var str = "<tf:text";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    xpath: function (value) {
        var str = "<tf:xpath";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    name: function (value) {
        var str = "<tf:name";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    url: function (value) {
        var str = "<tf:url";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    href: function (value) {
        var str = "<tf:href";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    id: function (value) {
        var str = "<tf:id";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    value: function (value) {
        var str = "<tf:value";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    caption: function (value) {
        var str = "<tf:caption";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    title: function (value) {
        var str = "<tf:title";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    alt: function (value) {
        var str = "<tf:alt";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    src: function (value) {
        var str = "<tf:src";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },
    action: function (value) {
        var str = "<tf:action";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },

    method: function (value) {
        var str = "<tf:method";
        str = addAttrs(str, {value:value});
        str += "/>";
        return wrap(str);
    },



/**
 * Utility functions.
 */
    addAttrs: function(str, attrs){
        for(var name in attrs){
            str+= name + "=\"" + attrs[name] + "\" ";
        }
        return str
    },

    wrap: function(finderStr){
        var ary = new Array();
        ary.push("<tf:Finder>");
        ary.push(finderStr);
        ary.push("/<tf:Finder>");
        return ary;
    }


}